package com.example.demo2.service.impl;

import com.example.demo2.dao.impl.UserDaoImpl;
import com.example.demo2.model.User;
import com.example.demo2.service.UserService;
import com.example.demo2.util.BCryptUtil;

public class UserServiceImpl implements UserService {
    @Override
    public User userLogin(String username, String password) {
        //通过用户名和密码查找用户
        UserDaoImpl userDao = new UserDaoImpl();
        User loginUser = userDao.findByUsername(username);
        //解密
        boolean verify = BCryptUtil.verify(password,loginUser.getPassword());
        if(verify){
            return loginUser;
        }else {
            return null;
        }
        // 日志记录
    }
}